// Configurações padroes para a utilização do JQuery com Rails
jQuery.noConflict()

//Novas caixas de dialogo para Confirm e Alert.
jQuery(document).ready(function(){ 
	jQuery('#alert').jqm({
		overlay: 60,
		overlayClass: 'overlay',
		modal: true,
		trigger: false
	});
	jQuery('#confirm').jqm({
		overlay: 60,
		overlayClass: 'overlay',
		modal: true,
		trigger: false
	});
});
function alert(msg) {
  jQuery('#alert')
    .jqmShow()
    .find('div.alertContent')
    .html("<img src='/images/icons/alert.gif' /><span>" + msg + "</span><div style='clear:both;font-size:1px'>&nbsp;</div>")
    .end()
    .find(':submit:visible')
    .click(function() {
    	jQuery('#alert').jqmHide();
    });
}
function confirm(msg,callback) {
  jQuery('#confirm')
    .jqmShow()
    .find('p.confirmMsg')
    .html("<img src='/images/icons/confirm.gif' /><span>" + msg + "</span><div style='clear:both;font-size:1px'>&nbsp;</div>")
    .end()
    .find(':submit:visible')
    .click(function(){
        if(this.value == 'Sim') {
           eval(callback);
        }
        callback = "";
        jQuery('#confirm').jqmHide();
    });
}


// Funções gerais do sistema
TrackSuite = function(){};

TrackSuite.util = function(){};
TrackSuite.util.element = function(){};
TrackSuite.util.element.hide = function(id){
    document.getElementById(id).style.display = "none";
};

TrackSuite.ajax = function(){};

TrackSuite.ajax.loadding = function(id,gif){
    if(gif){
        document.getElementById(id).innerHTML = '<img src="/images/icons/'+gif+'" />';
    } else {
        document.getElementById(id).innerHTML = '<img src="/images/icons/ajax.gif" />';
    }
};

TrackSuite.ajax.loaded = function(){};
TrackSuite.ajax.loaded.create = function(id){
    document.getElementById(id).innerHTML = '<img src="/images/icons/create.gif" />';
};

TrackSuite.ajax.loaded.clear = function(id){
    document.getElementById(id).innerHTML = '';
};

TrackSuite.form = function(){};

